import { GET_CATEGORIES } from '@/store/categories/CONST'
import { Categories, State } from '@/store/categories/interface'

export default {
  [GET_CATEGORIES] (state:State, data:{ pagesize:number, pagenum:number, total:number, result: Array<
  Categories >}
  ) {
    const newState:State = {
      categories: data.result,
      pagenum: data.pagenum + 1,
      pagesize: data.pagesize,
      count: data.total
    }
    state.categories = data.result
    state.pagenum = data.pagenum + 1
    state.pagesize = data.pagesize
    state.count = data.total
  }
}
